////////////////////////////////////////////////////////////////
//	File	:	"CLevelEngine.h"
//
//	Author	:	James Gonzalez (JG)
//
//	Purpose	:	This class loads all the level data for the game
////////////////////////////////////////////////////////////////
#pragma once

#include <Windows.h>
#include <vector>
#include "CBlock.h"
#include "CObjectFactory.h"

class CSGD_TextureManager;
class CObjectManager;
class CEventSystem;

class CLevelEngine
{
private:
	


	CSGD_TextureManager * pTM;
	CObjectManager* m_pOM;
	CEventSystem*	m_pES;

	CBlock * m_cSpawnPoint;
	int m_nImageID[35];
	int m_nAllIamges;

	int m_nPlayerImage;
	
	int m_nLevelPosX;
	int m_nLevelPosY;
	char m_szFileName[256];
	
	CObjectFactory<string, CBase> * m_pFactory;
	
	//	Trilogy of EVIL!
	//	constructor
	CLevelEngine(void);
	//	copy constructor
	CLevelEngine(const CLevelEngine&);
	//	assignment operator
	CLevelEngine& operator=(const CLevelEngine&);

	//	Plus destructor!
	~CLevelEngine(void);

public:

	enum BlockTypes { ERASE, 
					  Start,
					  Exit,
					  Block_All,
					  Block_Horizontal,	
					  Block_HorizontalAuto,
					  Block_Static,
					  Block_Vertical,
					  Block_VerticalAuto,
					  Bomb_Enemy,
					  Bomb_force,
					  Bomb_Regular,
					  Door_Blue,
					  Door_Green,
					  Door_Red,
					  Door_Yellow,
					  Key_Blue,
					  Key_Green,
					  Key_Red,
					  Key_Yellow,
					  PowerUp_Balloon,
					  PowerUp_Brick,
					  PowerUp_Goo,
					  PowerUp_MetalBoots,
					  PowerUp_Mirror,
					  PowerUp_Parachute,
					  PowerUp_Spring,
					  Enemy_Simple,
					  Enemy_Jumping,
					  Enemy_Zombie,
					  SpikeUp,
					  SpikeDown,
					  SpikeLeft,
					  SpikeRight,
					  Turret_Target,
					  Turret_Up,
					  Turret_Down,
					  Turret_Left,
					  Turret_Right};

					 






	////////////////////////////////////////////////////////
	//	Function:	"Accessors"
	//	Last Modifies: September 4,2008
	//	Purpose:	Get data
	////////////////////////////////////////////////////////
	int * GetImageID() { return m_nImageID; }
	int GetAllID() {return m_nAllIamges; }
	int GetLevelPosX() const { return m_nLevelPosX; }
	int GetLevelPosY() const { return m_nLevelPosY; }
	CBlock * GetSpawnPoint() const { return m_cSpawnPoint; }



	////////////////////////////////////////////////////////
	//	Function:	"Mutators"
	//	Last Modifies: September 4,2008
	//	Purpose:	Get data
	////////////////////////////////////////////////////////
	void SetLevelPosX(int val) { m_nLevelPosX = val; }
	void SetLevelPosY(int val) { m_nLevelPosY = val; }
	void SetSpawnPoint(CBlock * val) { m_cSpawnPoint = val; }
	void SetFileName(char * szFileName) { sprintf_s(m_szFileName, "%s", szFileName); }


	////////////////////////////////////////////////////////
	//	Function:	"GetInstance"
	//	Last Modifies: August 22,2008
	//	Purpose:	To return the singleton's instance.
	////////////////////////////////////////////////////////
	static CLevelEngine* GetInstance(void);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	"LoadLevel"
	//	Last Modified: August 22,2008
	//	Purpose:	Loads the Level
	//////////////////////////////////////////////////////////////////////////
	bool LoadLevel(const char*szFileName);
	
	//////////////////////////////////////////////////////////////////////////
	//	Function:	"UnloadLoadLevel"
	//	Last Modified: August 25,2008
	//	Purpose:	Unloads the Level
	//////////////////////////////////////////////////////////////////////////
	void UnloadLoadLevel();



	///////////////////////////////////////////////////////////////////////////
	//	Function:	"ReloadLevel"
	//	Last Modified: August 22,2008
	//	Purpose:	Restarts the level from scratch
	//////////////////////////////////////////////////////////////////////////
	void ReloadLevel();


	//////////////////////////////////////////////////////////////////////////
	//	Function:	"CreateBlock"
	//	Last Modified: September 6,2008
	//	Purpose:	Creates a Block
	//////////////////////////////////////////////////////////////////////////
	void CreateBlock(int nBlockType,int nX, int nY);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	"CreatePowerUp"
	//	Last Modified: September 6,2008
	//	Purpose:	Creates a PowerUp
	//////////////////////////////////////////////////////////////////////////
	void CreatePowerUp(int nPowerUpType,int nX, int nY);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	"CreateEnemy"
	//	Last Modified: September 6,2008
	//	Purpose:	Creates an Enemy
	//////////////////////////////////////////////////////////////////////////
	void CreateEnemy(int nEnemyType, int nX, int nY);

	//////////////////////////////////////////////////////////////////////////
	//	Function:	"CreateTurret"
	//	Last Modified: September 6,2008
	//	Purpose:	Creates a Turret
	//////////////////////////////////////////////////////////////////////////
	void CreateTurret(int nTurretType, int nX, int nY);
};

